package com.example.consumer;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.Objects;

/**
 * @Classname ConsumerService
 * @Description
 * @Author caozhenhao001
 * @Date 2024/4/9
 * @Version
 */
@Slf4j
@Component
@RocketMQMessageListener(
        topic = "${rocketmq.consumer.topic}",
        consumerGroup = "${rocketmq.consumer.group}"
)
public class ConsumerService implements RocketMQListener<String> {

    @Override
    public void onMessage(String message) {
        log.info("接收[RocketMQ]通知, message: {}", JSON.toJSONString(message));
    }


}
